package com.zhitan.ems.app.patrol.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhitan.ems.app.patrol.entity.PatrolTrackEntity;
import com.zhitan.ems.app.patrol.mapper.PatrolTrackMapper;
import com.zhitan.ems.app.patrol.service.PatrolTrackService;
import com.zhitan.ems.app.patrol.vo.PatrolTrackVO;
import com.zhitan.ems.framework.core.mp.base.BaseServiceImpl;
import com.zhitan.ems.framework.core.vo.VPage;
import com.zhitan.ems.framework.core.vo.VQueryKit;




@Service
public class PatrolTrackServiceImpl extends BaseServiceImpl<PatrolTrackMapper, PatrolTrackEntity> implements PatrolTrackService {
    
    @Override
	public VPage<PatrolTrackVO> selectPatrolTrackPage(IPage<PatrolTrackVO> page, PatrolTrackVO PatrolTrack) {
		return new VPage<PatrolTrackVO>(baseMapper.selectPatrolTrackPage(page,  VQueryKit.getQueryByMap(PatrolTrack)), page);	
	}
	
	  @Override
	public VPage<PatrolTrackVO> selectPatrolTrackMapPage(IPage<PatrolTrackVO> page,Map<String, Object> params) {
		return new VPage<PatrolTrackVO>(baseMapper.selectPatrolTrackPage(page, params), page);	
	}
	
	
	@Override
	public List<PatrolTrackEntity> queryList(Map<String, Object> params) {
		   QueryWrapper<PatrolTrackEntity> queryWrapper =VQueryKit.getQueryWrapperByMap(params, PatrolTrackEntity.class);
		   if(VQueryKit.isPage(params)) {
			   queryWrapper.last(VQueryKit.getPageLimit(params));
		    }
		   return this.list(queryWrapper);
	}
	@Override
	public VPage<PatrolTrackEntity> queryPage(Map<String, Object> params) {
		   QueryWrapper<PatrolTrackEntity> queryWrapper =VQueryKit.getQueryWrapper(params, PatrolTrackEntity.class);
		   IPage<PatrolTrackEntity> pages =this.page(VQueryKit.getPage(params), queryWrapper);
		   return VPage.create(pages);
	}
	@Override
	public long queryTotal(Map<String, Object> params) {
		  QueryWrapper<PatrolTrackEntity> queryWrapper =VQueryKit.getQueryWrapperByMap(params, PatrolTrackEntity.class);
		  return this.count(queryWrapper);
	}

}